package com.yanqu.road.server.cmd.activity.horserun.fromcross;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.HorseRunProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.horserun.HorseRunActivityModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_HORSE_RUN_GET_UNION_RANCH_DATA_RESP,desc = "小马快跑获取商会数据返回")
public class HorseRunCrossGetUnionDataToGameCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        HorseRunProto.HorseRunGetUnionRanchDataAndExpResp resp = HorseRunProto.HorseRunGetUnionRanchDataAndExpResp.parseFrom(packet.getBytes());
        if (resp.getRet() == 0){
            resp = player.getModule(HorseRunActivityModule.class).dealHorseRanchAndAddExpData(resp);
        }
        player.sendPacket(ClientProtocol.U_HORSE_RUN_GET_UNION_HORSE_RANCH_DATA,resp.toBuilder());


    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
